package com.japp.sys.service;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.japp.base.BaseService;
import com.japp.sys.bean.UploadFile;
import com.japp.sys.mapper.UploadMapper;
import com.japp.tools.common.JappLog;

@Service
@Transactional(rollbackFor = Exception.class)
public class UploadService implements BaseService{
	@Autowired
	private UploadMapper uploadMapper;
	
	public List<UploadFile> queryListUploadAll(UploadFile uploadfile) {
		try {
			List<UploadFile> list = uploadMapper.queryListUploadAll(uploadfile);
			return list;
		} catch (Exception e) {
			JappLog.log.error("",e);
		}
		return null;
	}
	
	public String queryUploadSplitByUpload(String[] keys,String fileFolder){
		try {
			return uploadMapper.queryUploadSplitByUpload(keys, fileFolder);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	public List<UploadFile> queryListUploadByUpload(UploadFile uploadfile) {
		try {
			List<UploadFile> list =uploadMapper.queryListUploadByUpload(uploadfile);
			return list;
		} catch (Exception e) {
			JappLog.log.error("",e);
		}
		return null;
	}

	
	public UploadFile queryUploadById(int id) {
		try {
			UploadFile rel = uploadMapper.queryUploadById(id);
			return rel;
		} catch (Exception e) {
			JappLog.log.error("",e);
		}
		return null;
	}

	
	public int deleteUploadById(int id) {
		try {
			int rel = uploadMapper.deleteUploadById(id);
			return rel;
		} catch (Exception e) {
			JappLog.log.error("",e);
		}
		return 0;
	}

	
	public int insertUpload(UploadFile uploadfile) {
		try {
			int rel = uploadMapper.insertUpload(uploadfile);
			return rel;
		} catch (Exception e) {
			JappLog.log.error("",e);
		}
		return 0;
	}

	
	public int deleteUploadByIds(String[] keys,String fileFolder) {
		try {
			int rel = uploadMapper.deleteUploadByIds(keys, fileFolder);
			return rel;
		} catch (Exception e) {
			JappLog.log.error("",e);
		}
		return 0;
	}

}
